;;lisp language 

(define (make-lang loc typ fn par-list)
  (cond
   ((or (eq? current-language 'lisp)
	(eq? current-language 'scheme)
	(eq? current-language 'elisp)
	(eq? current-language 'racket))
    (make-lisp loc typ fn par-list))
   (else (err-msg "[~a]make-lang：[~a]语言未定义。" current-language)
	 #f)))
(define (make-lisp loc typ fn par-list)
  (cond
   ((eq? typ 'y表达式调用)
    (list (append (list (intern fn) (reverse par-list)))))
   ((eq? typ '无参函数调用)
    (list (intern fn)))
   ((eq? typ '变量引用)
    (intern fn))
   ((eq? typ '变量赋值并引用)
    (push-let-stack fn par-list)
    (intern fn))
   ((eq? typ '片段宏引用)
    (get-macro-from-stack fn par-list))
   ((eq? typ '系统常量)
    (make-system-constant loc current-language fn))
   ;;((eq? typ '位置宏前引用)
   ;;(merge-macro-before-sexp loc fn par-list))
   ;;((eq? typ '位置宏后引用)
   ;;(merge-macro-after-sexp loc fn par-list))
   ;;add more typ here 
   (else (err-msg "[~a]make-lisp：[%s]类型语句处理未定义。" typ)
	 #f)))
(define (make-system-constant loc lang val)
  (cond
   ((or (eq? lang 'lisp)(eq? lang 'elisp))
    (cond
     ((or (string=? val "#N")(string=? val "#空")(string=? val "#F")(string=? val "#假")(string=? val "#E")(string=? val "#错")(string=? val "#U")(string=? val "#未"))
      'nil)
     ((or (string=? val "#T")(string=? val "#真"))
      't)
     (else (err-mag "[~a]make-system-constant：[~a]中[~a]系统常量没有定义，返回#f。" loc lang val)
	   #f)))
   ((or (eq? lang 'scheme)(eq? lang 'racket))
    (cond
     ((or (string=? val "#N")(string=? val "#空"))
      '())
     ((or (string=? val "#F")(string=? val "#假")(string=? val "#E")(string=? val "#错")(string=? val "#U")(string=? val "#未"))
      #f)
     ((or (string=? val "#T")(string=? val "#真"))
      #t)
     (else (err-mag "[~a]make-system-constant：[~a]中[~a]系统常量没有定义，返回#f。"loc lang val)
	   #f)))
   (else  (err-mag "[~a]make-system-constant：[~a]语言没有定义，返回#f。"loc lang val)
	   #f)))
     
(define (merge-lang loc lang-l st)
  (cond
   ((or (eq? current-language 'lisp)
	(eq? current-language 'elisp)
	(eq? current-language 'scheme)
	(eq? current-language 'racket))
    (merge-lisp loc lang-l st))
   (else (err-msg "[~a]merge-lang：[~a]语言未定义。" loc current-language))))
